package priv.yiyuan.example.design.chain;

/**
 * 优惠券折扣
 *
 * @author YiYuan
 * @data 2025/10/11
 * @apoNote
 */
public class CouponDiscountStrategy implements DiscountStrategy {

    @Override
    public double calculateDiscount(Order order) {

        if (order.getCouponCode() != null && !order.getCouponCode().isEmpty()) {
            if (order.getOriginalPrice() >= 100 && "SAVE20".equals(order.getCouponCode())) {
                order.addAppliedDiscountInfo("优惠券折扣(满100减20)");
                System.out.println("应用优惠券折扣: 优惠 20.00 元");
                return 20.0;
            }
        }

        return 0;
    }
}
